
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>CommentsLogByMySQL · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../END.html" />
    
    
    <link rel="prev" href="DDMonitor.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    综述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    软件目录
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="DDMonitor.html">
            
                <a href="DDMonitor.html">
            
                    
                    DDMonitor
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.2" data-path="CommentsLogByMySQL.html">
            
                <a href="CommentsLogByMySQL.html">
            
                    
                    CommentsLogByMySQL
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../END.html">
            
                <a href="../END.html">
            
                    
                    结语
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >CommentsLogByMySQL</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="commentslogbymysql">CommentsLogByMySQL</h1>
<p>&#x5DF2;&#x505C;&#x6B62;&#x66F4;&#x65B0;&#xFF0C;API&#x4F30;&#x8BA1;&#x4E5F;&#x4E0D;&#x80FD;&#x7528;&#x4E86;</p>
<p>&#x7528;MySQL&#x6765;&#x50A8;&#x5B58;&#x8BB0;&#x5F55;&#x76F4;&#x64AD;&#x95F4;&#x5F39;&#x5E55;&#x4FE1;&#x606F;&#xFF0C;&#x4F9B;&#x623F;&#x7BA1;&#x67E5;&#x8BE2;&#x4F7F;&#x7528;
<strong>&#x76EE;&#x524D;&#x4EC5;&#x652F;&#x6301;Linux&#x7CFB;&#x7EDF;&#xFF0C;&#x6CA1;&#x529E;&#x6CD5;bat&#x6211;&#x771F;&#x5199;&#x4E0D;&#x6765;</strong></p>
<h3 id="&#x901A;&#x8FC7;python&#x811A;&#x672C;&#x5C06;&#x76F4;&#x64AD;&#x95F4;&#x5F39;&#x5E55;&#x6252;&#x4E0B;&#x6765;&#x5B58;&#x5728;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#xFF0C;&#x9700;&#x8981;mysql&#x652F;&#x6301;&#xFF0C;&#x5DF2;&#x5B9E;&#x88C5;b&#x7AD9;&#x76F4;&#x64AD;&#x81EA;&#x52A8;&#x68C0;&#x6D4B;&#x529F;&#x80FD;">&#x901A;&#x8FC7;python&#x811A;&#x672C;&#x5C06;&#x76F4;&#x64AD;&#x95F4;&#x5F39;&#x5E55;&#x6252;&#x4E0B;&#x6765;&#x5B58;&#x5728;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#xFF0C;<strong>&#x9700;&#x8981;MySQL&#x652F;&#x6301;</strong>&#xFF0C;&#x5DF2;&#x5B9E;&#x88C5;B&#x7AD9;&#x76F4;&#x64AD;&#x81EA;&#x52A8;&#x68C0;&#x6D4B;&#x529F;&#x80FD;</h3>
<p><strong><em>&#x4EC5;&#x652F;&#x6301;BILIBILI&#x76F4;&#x64AD;</em></strong></p>
<p>&#x8EAB;&#x4E3A;&#x4E00;&#x540D;&#x623F;&#x7BA1;&#xFF08;DD&#xFF09;&#xFF0C;&#x5E73;&#x65F6;&#x603B;&#x6709;&#x5F88;&#x591A;&#x4EBA;&#x79C1;&#x4FE1;&#x8BE2;&#x95EE;&#x201C;&#x554A;&#xFF0C;&#x6211;&#x53EA;&#x5728;&#x76F4;&#x64AD;&#x95F4;&#x53D1;&#x4E86;&#x4E00;&#x4E2A;&#x201C;xxx&#x201D;&#x600E;&#x4E48;&#x5C31;&#x88AB;&#x5C01;&#x4E86;&#xFF0C;&#x662F;&#x4E0D;&#x662F;&#x8BEF;&#x5224;&#x4E86;&#x201D;<br>&#x4E00;&#x65B9;&#x9762;&#x4E3A;&#x4E86;&#x7ED9;&#x5927;&#x5BB6;&#x4E00;&#x4E2A;&#x516C;&#x9053;<br>&#x53E6;&#x4E00;&#x65B9;&#x9762;&#x4E5F;&#x662F;&#x9632;&#x6B62;&#x6709;&#x4EBA;&#x94BB;&#x7A7A;&#x5B50;<br>&#x518D;&#x6709;&#x5C31;&#x662F;&#x51CF;&#x8F7B;&#x623F;&#x7BA1;&#x7684;&#x538B;&#x529B;<br>&#x6211;&#xFF0C;DD&#xFF08;X&#xFF09;&#xFF0C;&#x7528;&#x4E1A;&#x4F59;&#x65F6;&#x95F4;&#x5199;&#x4E86;&#x8FD9;&#x4E48;&#x4E00;&#x4E2A;&#x5C0F;&#x4E1C;&#x897F;&#xFF0C;&#x65B9;&#x4FBF;&#x5F39;&#x5E55;&#x8BB0;&#x5F55;  </p>
<p><strong><em>&#x7531;&#x4E8E;&#x672C;&#x8EAB;&#x6CA1;&#x5B66;&#x8FC7;python&#x6240;&#x4EE5;&#x76F8;&#x5F53;&#x4E8E;&#x73B0;&#x5B66;&#x73B0;&#x7528;&#xFF0C;&#x4EE3;&#x7801;&#x5199;&#x5F97;&#x8FA3;&#x9E21;&#x7684;&#x4E00;&#x6279;</em></strong>  </p>
<p><strong>&#x7531;&#x4E8E;&#x6211;&#x672C;&#x8EAB;&#x662F;mea gachi&#x6240;&#x4EE5;&#x6240;&#x6709;&#x7684;&#x914D;&#x7F6E;&#x662F;&#x4EE5;mea&#x76F4;&#x64AD;&#x95F4;&#x4E3A;&#x8303;&#x672C;&#x7684;&#xFF0C;&#x5982;&#x9700;&#x5728;&#x5176;&#x4ED6;&#x76F4;&#x64AD;&#x95F4;&#x4F7F;&#x7528;&#x8BF7;&#x81EA;&#x884C;&#x66F4;&#x6539;&#x811A;&#x672C;&#xFF0C;&#x9700;&#x8981;&#x66F4;&#x6539;&#x7684;&#x4F4D;&#x7F6E;&#x5DF2;&#x5728;&#x811A;&#x672C;&#x4E2D;&#x6307;&#x51FA;</strong></p>
<h4 id="&#x5B89;&#x88C5;&#x65B9;&#x6CD5;">&#x5B89;&#x88C5;&#x65B9;&#x6CD5;</h4>
<pre><code>apt&#xFF1A;
$ wget https://dreammer12138.github.io/Documents/CommentsLogByMySQL/apt-setup.sh
$ sudo chmod 777 ./apt-setup.sh
$ ./apt-setup.sh

yum:
$ wget https://dreammer12138.github.io/Documents/CommentsLogByMySQL/yum-setup.sh
$ sudo chmod 777 ./yum-setup.sh
$ ./yum-setup.sh
</code></pre><p>&#x5B89;&#x88C5;&#x4F4D;&#x7F6E;&#xFF1A;<code>/usr/CommentsLogByMySQL/</code>  </p>
<h4 id="&#x914D;&#x7F6E;">&#x914D;&#x7F6E;</h4>
<p><strong> MySQL </strong>  </p>
<pre><code>&#x914D;&#x7F6E;MySQL&#x7528;&#x6237;&#x5BC6;&#x7801;
$ sudo mysql
&gt;&gt; use mysql;
&gt;&gt; update user set plugin=&quot;mysql_native_password&quot; where user=&quot;root&quot;;
&gt;&gt; flush privileges;
&gt;&gt; update user set authentication_string=PASSWORD(&quot;&#x65B0;&#x5BC6;&#x7801;&quot;) where user=&quot;root&quot;;
&gt;&gt; flush privileges;
&gt;&gt; exit;

&#x91CD;&#x542F;MySQL
$ sudo /etc/init.d/mysql restart

&#x767B;&#x5F55;MySQL&#xFF08;&#x4E0D;&#x4F7F;&#x7528;sudo&#x6743;&#x9650;&#xFF09;,&#x5982;&#x679C;&#x53EF;&#x4EE5;&#x767B;&#x5F55;&#x8FDB;&#x53BB;&#x5C31;&#x8BF4;&#x660E;&#x914D;&#x7F6E;&#x5B8C;&#x6210;
$ mysql -u root -p

&#x65B0;&#x5EFA;&#x6570;&#x636E;&#x5E93;
&gt;&gt; create database Bili_Comments character set &apos;utf8&apos; collate &apos;utf8_general_ci&apos;;
&gt;&gt; exit;
</code></pre><p><strong> config.json </strong>  </p>
<p><strong><em>&#x6240;&#x6709;&#x7684;&#x914D;&#x7F6E;&#x4FE1;&#x606F;&#x90FD;&#x5B58;&#x50A8;&#x5728;config.json&#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x4FEE;&#x6539;&#x524D;&#x8BF7;&#x52A1;&#x5FC5;&#x5907;&#x4EFD;&#x597D;&#x539F;&#x914D;&#x7F6E;</em></strong></p>
<p>&#x6570;&#x636E;&#x5E93;&#x50A8;&#x5B58;&#xFF1A;&#x4FEE;&#x6539;&#x201C;comments&#x201D;-&gt;&#x201C;mysql&#x201D;  </p>
<pre><code>&quot;mysql&quot;: {
    &quot;host&quot;: &quot;localhost&quot;,        &lt;-&#x6570;&#x636E;&#x5E93;&#x5730;&#x5740;&#xFF0C;&#x5982;&#x679C;&#x662F;&#x672C;&#x5730;&#x6570;&#x636E;&#x5E93;&#x5C31;&#x9ED8;&#x8BA4;&#x4E0D;&#x8981;&#x4FEE;&#x6539;
    &quot;port&quot;: 3306,            &lt;-&#x6570;&#x636E;&#x5E93;&#x7AEF;&#x53E3;&#xFF0C;&#x9ED8;&#x8BA4;3306&#xFF0C;&#x4E0D;&#x5EFA;&#x8BAE;&#x4FEE;&#x6539;
    &quot;user&quot;: &quot;root&quot;,            &lt;-mysql&#x7528;&#x6237;&#x540D;&#xFF0C;&#x4E0D;&#x5EFA;&#x8BAE;&#x4FEE;&#x6539;
    &quot;password&quot;: &quot;123456&quot;,        &lt;-mysql&#x5BC6;&#x7801;&#xFF0C;&#x6839;&#x636E;&#x914D;&#x7F6E;&#x6570;&#x636E;&#x5E93;&#x65F6;&#x8BBE;&#x7F6E;&#x7684;&#x5BC6;&#x7801;&#x4FEE;&#x6539;
    &quot;db&quot;: &quot;Bili_Comments&quot;,        &lt;-&#x6570;&#x636E;&#x5E93;&#x540D;&#xFF0C;&#x6839;&#x636E;&#x914D;&#x7F6E;&#x6570;&#x636E;&#x5E93;&#x65F6;&#x65B0;&#x5EFA;&#x7684;&#x6570;&#x636E;&#x5E93;&#x4FEE;&#x6539;
    &quot;charset&quot;: &quot;utf8&quot;        &lt;-&#x6570;&#x636E;&#x5E93;&#x6570;&#x636E;&#x7F16;&#x7801;&#x65B9;&#x5F0F;&#xFF0C;&#x9ED8;&#x8BA4;utf-8&#xFF0C;&#x4E0D;&#x5EFA;&#x8BAE;&#x4FEE;&#x6539;
}
</code></pre><p>&#x5F39;&#x5E55;&#x59EC;&#x914D;&#x7F6E;&#xFF1A;&#x4FEE;&#x6539;&#x201C;comments&#x201D;-&gt;&#x201C;room&#x201D;</p>
<pre><code>&quot;room&quot;: {
    &quot;roomid&quot;: &quot;12235923&quot;,        &lt;-&#x8FD9;&#x91CC;&#x586B;&#x5199;&#x76F4;&#x64AD;&#x95F4;&#x53F7;&#x7801;
    &quot;csrf_token&quot;: &quot;&quot;,
    &quot;csrf&quot;: &quot;&quot;,
    &quot;visit_id&quot;: &quot;&quot;
}
</code></pre><p>&#x76F4;&#x64AD;&#x68C0;&#x6D4B;&#x914D;&#x7F6E;&#xFF1A;&#x4FEE;&#x6539;&#x201C;check&#x201D;&#x548C;&#x201C;getInfo&#x201D;</p>
<pre><code>&quot;check&quot;: {
    &quot;headers&quot;: {
        &quot;Accept&quot;: &quot;application/json, text/plain, */*&quot;,
        &quot;Origin&quot;: &quot;https://space.bilibili.com&quot;,
        &quot;Referer&quot;: &quot;https://space.bilibili.com/349991143&quot;,                &lt;-&#x4FEE;&#x6539;&#x6B64;&#x5904;
        &quot;User-Agent&quot;: &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36&quot;
    },
    &quot;url&quot;: &quot;https://api.live.bilibili.com/room/v1/Room/getRoomInfoOld?mid=349991143&quot;    &lt;-&#x4FEE;&#x6539;&#x6B64;&#x5904;&#x53EA;&#x9700;&#x8981;&#x628A;mid&#x540E;&#x9762;&#x7684;&#x90A3;&#x4E32;&#x6570;&#x5B57;&#x4FEE;&#x6539;&#x4E3A;&#x4E3B;&#x64AD;UID&#x5373;&#x53EF;
},
&quot;getInfo&quot;: {
    &quot;headers&quot;: {
        &quot;Accept&quot;: &quot;application/json, text/plain, */*&quot;,
        &quot;Origin&quot;: &quot;https://space.bilibili.com&quot;,
        &quot;Referer&quot;: &quot;https://space.bilibili.com/349991143&quot;,                &lt;-&#x4FEE;&#x6539;&#x6B64;&#x5904;
        &quot;User-Agent&quot;: &quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36&quot;
    },
    &quot;url&quot;: &quot;https://api.bilibili.com/x/space/acc/info?mid=349991143&amp;jsonp=jsonp&quot;        &lt;-&#x4FEE;&#x6539;&#x6B64;&#x5904;&#x53EA;&#x9700;&#x8981;&#x628A;mid&#x540E;&#x9762;&#x7684;&#x90A3;&#x4E32;&#x6570;&#x5B57;&#x4FEE;&#x6539;&#x4E3A;&#x4E3B;&#x64AD;UID&#x5373;&#x53EF;
}
</code></pre><h4 id="&#x4F7F;&#x7528;&#x65B9;&#x6CD5;">&#x4F7F;&#x7528;&#x65B9;&#x6CD5;</h4>
<pre><code>$ sudo bash /usr/CommentsLogByMySQL/CommentsLogByMySQL.sh
</code></pre><p>&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;screen&#x5355;&#x72EC;&#x8FD0;&#x884C;  </p>
<p>&#x521B;&#x5EFA;&#x65B0;&#x8FDB;&#x7A0B; <code>$ screen -S &lt;&#x4F60;&#x7684;&#x8FDB;&#x7A0B;&#x540D;&#x79F0;&gt;</code><br>&#x540E;&#x53F0;&#x8FD0;&#x884C;&#x8FDB;&#x7A0B; <code>Ctrl + A + D</code><br>&#x8FD4;&#x56DE;&#x8FDB;&#x7A0B; <code>$ screen -R &lt;&#x4F60;&#x7684;&#x8FDB;&#x7A0B;&#x540D;&#x79F0;&gt;</code>  </p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="DDMonitor.html" class="navigation navigation-prev " aria-label="Previous page: DDMonitor">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../END.html" class="navigation navigation-next " aria-label="Next page: 结语">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"CommentsLogByMySQL","level":"1.2.2","depth":2,"next":{"title":"结语","level":"1.3","depth":1,"path":"END.md","ref":"END.md","articles":[]},"previous":{"title":"DDMonitor","level":"1.2.1","depth":2,"path":"software/DDMonitor.md","ref":"software/DDMonitor.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"software/CommentsLogByMySQL.md","mtime":"2019-12-16T13:22:43.594Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-12-16T13:27:49.278Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

